<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<script language="javascript">
//load jquery
google.load("jquery",1);


var g_timer=3;
function ONLOAD()
{
	setInterval(function()
	{
		//cd('work')
		$('#timer').text(g_timer);
		g_timer=g_timer-1;
		if(g_timer==0)
		{
			/*test*/
			var time = new Date();
			$('#secs').val(time.getSeconds());
			
			$.ajax({
			  type: "POST",
			  url: "sendMsg",
			  data: "msg=" + $('#textarea').val()+ ' ' + $('#secs').val() ,
			  dataType: "text",
			  success: function(msg){
				$('#work').text(msg);;
			   }
			});
			
			g_timer=$('#setTime').val();
			
		}
	},1000);
}	
</script>
</head>
<body >
<input type="button" onclick="ONLOAD()" value='work' />
maintain seconds<div id="timer" ></div><p />
set seconds:<input type="text" name="setTime" id="setTime" value="3" /><p />
what you want to say:

<input cols="50" rows="10"  id="secs" ></textarea>
 <p /> 

<input cols="50" rows="10"  id="textarea" > </textarea>
<p />

<div id="work"></div>
</body>
</html>